 
 function ord(string) {
  var str = string + '',
    code = str.charCodeAt(0);
  if (0xD800 <= code && code <= 0xDBFF) { // High surrogate (could change last hex to 0xDB7F to treat high private surrogates as single characters)
    var hi = code;
    if (str.length === 1) {
      return code; // This is just a high surrogate with no following low surrogate, so we return its value;
      // we could also throw an error as it is not a complete character, but someone may want to know
    }
    var low = str.charCodeAt(1);
    return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
  }
  if (0xDC00 <= code && code <= 0xDFFF) { // Low surrogate
    return code; // This is just a low surrogate with no preceding high surrogate, so we return its value;
    // we could also throw an error as it is not a complete character, but someone may want to know
  }
  return code;
}
 function utf8ToUnicode(str)
{
    var unicode = [];        
    var values = [];
    var lookingFor = 1;
     
    for (var i = 0; i < str.length; i++ ) {
 
        var thisValue = ord( str[ i ] );
         
        if ( thisValue < 128 ) unicode.push(thisValue);
        else {
         
            if ( values.length == 0 ) lookingFor = ( thisValue < 224 ) ? 2 : 3;
             
            values.push(thisValue);
             
            if ( values.length == lookingFor ) {
         
                var number = ( lookingFor == 3 ) ?
                    ( ( values[0] % 16 ) * 4096 ) + ( ( values[1] % 64 ) * 64 ) + ( values[2] % 64 ):
                    ( ( values[0] % 32 ) * 64 ) + ( values[1] % 64 );
                     
                unicode.push(number);
                values = [];
                lookingFor = 1;
         
            } // if
         
        } // if
         
    } // for
    return unicode;
}

function isJapanese(unicodeVal)
{
    var ret = 0;
    //unicodeVal is a single value only
    if (unicodeVal == 8221)
    {
        //right double quotation
        ret = 3;
    }
    else if (unicodeVal >= 12288 && unicodeVal <= 12351)
    {
        //Japanese Style Punctuation
        ret = 3;
    }
    else if (unicodeVal >= 12352 && unicodeVal <= 12447)
    {
        //Hiragana
        ret = 3;
    }
    else if (unicodeVal >= 12448 && unicodeVal <= 12543)
    {
        //Katakana
        ret = 3;
    }
    else if(unicodeVal >= 12784 && unicodeVal <= 12799)
    {
        ret = 3;
    }
    else if (unicodeVal >= 12800 && unicodeVal <= 13054)
    {
        ret = 3;
    }
    else if (unicodeVal >= 65280 && unicodeVal <= 65376)
    {
        //full width roman character (Zen Kaku)
        ret = 1;
    }
    else if (unicodeVal >= 65377 && unicodeVal <= 65439)
    {
        //half width character (Han Kaku)
        ret = 2;
    }
    else if (unicodeVal >= 65504 && unicodeVal <= 65510)
    {
        //full width character (Zen Kaku)
        ret = 1;
    }
    else if (unicodeVal >= 65512 && unicodeVal <= 65518)
    {
        //half width character (Han Kaku)
        ret = 2;
    }
    else if (unicodeVal >= 19968 && unicodeVal <= 40879)
    {
        //common and uncommon kanji
        ret = 3;
    }
    else if (unicodeVal >= 13312 && unicodeVal <= 19903)
    {
        //Rare Kanji
        ret = 3;
    }
     
    return ret;
}

function detectZenKaku(str)
{
    var unicode = utf8ToUnicode(str);
    var ret = true;
     
    for (var i = 0; i < unicode.length;i ++)
    {
		var uni = unicode[i];
        var chk = isJapanese(uni);
        if (chk == 0 || chk == 2)
        {
            //non-japanese or han kaku found!
            ret = false;
            break;
        }
    }
     
    return ret;
}